package java8.methodReference;

import java.util.Arrays;
import java.util.List;

public class Basic {
	public static void main(String[] args) {
		List<Person> persons = Arrays.asList(new Person[]{new Person(3, "3岁"),new Person(1, "1岁"),new Person(2, "2岁")});
		persons.forEach(System.out::println);
	}
}
class Person{
	private int age;
	private String name;
	public Person(int age, String name) {
		super();
		this.age = age;
		this.name = name;
	}
	public int getAge() {
		return age;
	}
	public int compareAge(Person person) {
		return this.age-person.age;
	}
	public static void showName(Person p) {
		System.out.println(p.name);
	}
	public void setAge(int age) {
		this.age = age;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Override
	public String toString() {
		return "Person [age=" + age + ", name=" + name + "]";
	}
}